package com.risk.modules.rm.controller;

import com.risk.common.Enums.DataEnum;
import com.risk.common.utils.R;
import com.risk.modules.rm.service.business.BusinessServiceSelector;
import com.risk.modules.sys.controller.AbstractController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/")
public class DataController extends AbstractController {
    private final static Logger LOG = LoggerFactory.getLogger(DataController.class);

    @Autowired
    private BusinessServiceSelector selector;

    @PostMapping("/query")
    public R query(@RequestParam(value = "name", required = false) String name,
                   @RequestParam(value = "idCard", required = false) String idCard,
                   @RequestParam(value = "mob", required = false) String mob,
                   @RequestParam(value = "bankCard", required = false) String bankCard,
                   @RequestParam(value = "ruleNos", required = false)List<DataEnum> ruleNos){

        selector.select(ruleNos.get(0)).query(name,idCard,mob,bankCard);

        return R.ok();
    }

}
